import com.zyt.entity.*;
import com.zyt.mapper.CategoryMapper;
import com.zyt.mapper.*;
import com.zyt.service.BookService;
import com.zyt.service.CategoryService;
import com.zyt.service.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;

@RunWith(SpringRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class test {
    @Autowired
    private BookService bookService;
    @Autowired
    private CategoryMapper categoryMapper;
    @Autowired
    private CategoryService categoryService;
    @Autowired
    private UserService userService;
    @Autowired
    private AddressService addressService;

    @Test
    public void test1(){
        List<Book> books = bookService.selectByRecommend();
        books.forEach(System.out::println);

    }
    @Test
    public void test2(){
        List<Book> books = bookService.selectByHot();
        books.forEach(System.out::println);

    }
    @Test
    public void test3(){
        List<Category> categories = categoryMapper.selectAllCategory();
        categories.forEach(System.out::println);

    }
    @Test
    public void test4(){
        List<Book> books = bookService.selectByLevelTwo(8);
        books.forEach(System.out::println);

    }
    @Test
    public void test5(){
        List<Book> books = bookService.selectByLevelOne(1);
        books.forEach(System.out::println);
    }
    @Test
    public void test6(){
        List<Category> categories = categoryService.selectByLevelTwo(8);
        categories.forEach(System.out::println);
    }
    @Test
    public void test7(){
        List<Category> categories = categoryService.selectByLevelOne(8);
        categories.forEach(System.out::println);
    }
    @Test
    public void test8(){
        User login = userService.login("123@qq.com","123456");
        System.out.println(login);
    }
    @Test
   public void test9(){
        List<Address> addresses = addressService.selectAllAddress(1);
        System.out.println(addresses);
    }

}
